package com.jeesite.modules.ad.web;

import javax.servlet.http.HttpServletRequest;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import com.jeesite.common.web.BaseController;
import com.jeesite.modules.ad.service.AdGuestService;
import com.jeesite.modules.ad.utils.api.utils.entity.JsonResult;
import com.jeesite.modules.ad.utils.api.utils.enums.JsonResultCodeEnum;

@RestController
@RequestMapping("/apiController")
public class ApiController extends BaseController {

	@Autowired
	private AdGuestService adGuestService;

	/**
	 * 获客信息新增接口
	 * 
	 * @param request
	 * @return
	 */
	@PostMapping(value = "T1001")
	public JsonResult T1001(HttpServletRequest request) {
		JsonResult t1001;
		try {
			t1001 = adGuestService.T1001(request);
		} catch (Exception e) {
			e.printStackTrace();
			// 异常
			t1001 = new JsonResult(JsonResultCodeEnum.SZF_SYS_ERROR.getCode(),
					JsonResultCodeEnum.SZF_SYS_ERROR.getMsg() + "<br/>" + e.getMessage(), null);
		}
		return t1001;
	}

	/**
	 * 获客信息新增接口
	 * 
	 * @param request
	 * @return
	 */
	@PostMapping(value = "T1002")
	public JsonResult T1002(HttpServletRequest request) {
		JsonResult t1002;
		try {
			t1002 = adGuestService.T1002(request);
		} catch (Exception e) {
			e.printStackTrace();
			// 异常
			t1002 = new JsonResult(JsonResultCodeEnum.SZF_SYS_ERROR.getCode(),
					JsonResultCodeEnum.SZF_SYS_ERROR.getMsg() + "<br/>" + e.getMessage(), null);
		}
		return t1002;
	}
}
